package com.pro.controller;

import com.pro.pojo.JsOperationLog;
import com.pro.pojo.JsonData;
import com.pro.service.JsOperationLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * ClassName:JsOperationLogController
 * Package:com.pro.controller
 * Description:
 *
 * @Date:2021/12/13 19:23
 * @Author: ZPT
 */
@RestController
@RequestMapping("/operationLog")
public class JsOperationLogController {
    @Autowired
    private JsOperationLogService service;

    @RequestMapping("/getOperationLogList")
    public JsonData getOperationLogList(String type,String executionTime,Integer operationType){
        List<JsOperationLog> operationLogList = service.getOperationLogList(type,executionTime,operationType);
         return operationLogList!=null?JsonData.buildSuccess(operationLogList):JsonData.buildError("服务端错误");
    }

    @RequestMapping("/removeLogById")
    public JsonData removeLogById(Integer id){
        Integer i = service.removeLogById(id);
        return i > 0 ? JsonData.buildSuccess(i): JsonData.buildError("服务端错误");
    }
}
